package com.drcoffee.drcoffeemall.controller;

import com.drcoffee.drcoffeemall.entry.Address;
import com.drcoffee.drcoffeemall.entry.Result;
import com.drcoffee.drcoffeemall.entry.search.PartSearch;
import com.drcoffee.drcoffeemall.service.PartsService;
import com.drcoffee.drcoffeemall.service.ExceptionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/*
 * 配件
 * */
@RestController
@RequestMapping("/part")
public class PartsController {
    @Autowired
    PartsService partsService;
    @Autowired
    ExceptionRecordService exceptionRecordService;

    @PostMapping("/getAttachment")
    public Result getAttachment(@RequestHeader String Token, @RequestBody PartSearch partSearch) {
        return partsService.getAttachment(Token, partSearch);
    }

    @PostMapping("/getAttachmentNoType")
    public Result getAttachmentNoType(@RequestHeader String Token, @RequestBody PartSearch partSearch) {
        return partsService.getAttachmentNoType(Token, partSearch);
    }

    @PostMapping("/getAttachmentMain")
    public Result getAttachmentMain(@RequestHeader String Token, @RequestBody PartSearch partSearch) {
        return partsService.getAttachmentMain(Token, partSearch);
    }


    @GetMapping("/getAttachmentById")
    public Result getAttachmentById(@RequestHeader String Token, @RequestParam String language, @RequestParam Integer dot_id) {
        return partsService.getAttachmentById(Token, language, dot_id);
    }

    @GetMapping("/getAttachmentByCode")
    public Result getAttachmentByCode(@RequestHeader String Token, @RequestParam String part_code) {
        return partsService.getAttachmentByCode(Token, part_code);
    }

    @GetMapping("/getGiveaway")
    public Result getGiveaway(@RequestHeader String Token, @RequestParam String language, @RequestParam Integer type, @RequestParam List<String> part_codes) {
        return partsService.getGiveaway(Token, language, type, part_codes);
    }
}
